import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("permission_role", { schema: "cabinet" })
export class PermissionRole {
  @PrimaryGeneratedColumn({ type: "smallint", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "name", length: 10 })
  name: string;

  @Column("json", { name: "menus", nullable: true, comment: "菜单" })
  menus: object | null;

  @Column("json", { name: "rules", nullable: true, comment: "权限" })
  rules: object | null;

  @Column("varchar", { name: "remark", length: 30 })
  remark: string;

  @Column("tinyint", { name: "source", comment: "0,1,2", default: () => "'1'" })
  source: number;

  @Column("int", {
    name: "creator_id",
    comment: "创建人",
    unsigned: true,
    default: () => "'0'",
  })
  creatorId: number;
}
